<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<script type="text/javascript" src="../js/jquery-3.3.1.js"></script>
<body>
	<input id="userid" value="${user.userId}" hidden="hidden"/>
	<a href="addFreeCar.jsp">登记车辆信息</a>
	<a href="index.jsp">返回</a>
	<table id="cartab" border="1px" cellpadding="0px"  cellpadding="0px">
		<tr><th>车ID<th><th>车牌号<th><th>类型<th><th>颜色<th><tr>
	</table>
</body>
	<script type="text/javascript">
		$(function(){
			$.ajax({
				url:'../freecar/findallcar',
				method:'get',
				contentType:'application/json',
				data:{'userId':$('#userid').val()},
				dataType:'json',
				success:function(data){
					$.each(data,function(){
						var tr = "<tr><td>"+this.carId+"<td>"+
								 "<td>"+this.license+"<td>"+
								 "<td>"+this.cartype+"<td>"+
								 "<td>"+this.carColor+"<td><tr>";
						$('#cartab').append(tr);
					});
				}
			})
		})
	</script>
</html>